<?php

namespace App\Modules\Index\Services;


use  App\Modules\Index\Models\Warning;
use DB;

class WarningService
{

    /**
     * 添加血糖
     * param array $data
     */
    public static function readWarning($user_id){

        $data = Warning::where('user_id',$user_id)->where('is_read',0)->update(['is_read'=>1]);

        $res = Warning::select('content','created_at')->where('user_id',$user_id)->where('type',1)->orderBy('id','desc')->paginate(10);

        return $res;

    }

}